<?php
//TG
require_once('./security.php');
 /*
  $filename = "../includes/menu.php";
  if (file_exists($filename)) {
    // Get the contents
    $file_contents = file_get_contents($filename);
    // $file_contents = stripslashes($file_contents);
  }*/

  if (isset($_POST['submit1'])) { // Handle the form.
    $content = $_POST['favourite'];
    $content = stripslashes($content);
    $linktext = $_POST['linktext'];
    $filename = '../textfiles/Favourites.txt';
    $fp = fopen($filename, "a+") or die("Couldn't open $filename.");
    fwrite($fp, "<a href=http://$content>$linktext</a>" . "|" . $linktext . "\n");
    fwrite($fp, "\r\n");
    fclose($fp);
    $response = "The favourite was added.";
  }

?>

<?php $thisPage = "favourites"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Edit the menu</title>
<meta name="robots" content="noindex,nofollow" />
<?php require_once('theme/admintheme.php');?>
</head>
<body>

<div id="wrap">



<?php include_once('navigation.php'); ?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

Favourite to Add<br />
Link Text<br /><input type="text" name="linktext" size="50" value="" maxlength="50" /><br />   
Html Link (Everything after the http://)<br />
<input type="text" name="favourite" id="favourite" size="100" value="" maxlength="100" />
<br />
<input type="submit" name="submit1" value="Add Favourite">
</form>

<?php echo $response; ?>



</div>

</body>
</html>
